package com.itheima.reggie.common.timedtask;

import org.apache.tomcat.util.http.fileupload.IOUtils;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.io.*;

/**
 * @author: Liu
 * @date: 2022/02/27
 * @time: 20:38
 */

//@Component
public class TimedTaskDelete {


/*
    public static File fileStart() {
        File file = new File("D:\\img");
        return file;
    }
*/

    //@Scheduled(cron = "0/30 * * * * MON-SUN")
    public void hello() {
        System.out.println("hello");
        /*FileInputStream inpit = null;
        OutputStream output = null;
        try {
            inpit = new FileInputStream("D:\\img\\13.png");
            output = new FileOutputStream("D:\\img\\saveImg\\13.png");
            IOUtils.copy(inpit, output);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }*/

        File file = new File("D:\\img");
        //File file = TimedTaskDelete.fileStart();
        File[] files = file.listFiles();
        for (File file1 : files) {
            if (file1.isFile()) {
                file1.delete();
            }
        }

    }
}
